package com.appspot.bs24event.controller.admin.event;

import java.util.List;

import org.apache.log4j.Logger;
import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import com.appspot.bs24event.model.Event;
import com.appspot.bs24event.service.EventService;

/**
 * ListControllerクラス。
 * @version $Id: ListController.java 66 2011-05-13 11:07:06Z bs24event@gmail.com $
 */
public class ListController extends Controller {

    /** ログ */
    protected static final Logger logger = Logger.getLogger(ListController.class.getName());

    private EventService service = new EventService();

    @Override
    protected Navigation setUp() {
        logger.info(this.getClass().getName() + " start.");
        return super.setUp();
    }

    @Override
    protected void tearDown() {
        logger.info(this.getClass().getName() + " end.");
        super.tearDown();
    }

    @Override
    public Navigation run() throws Exception {
        // これからのイベント一覧の取得
        List<Event> futureEventList = service.getFutureList();
        requestScope("futureEventList", futureEventList);

        // 過去のイベント一覧の取得
        List<Event> pastEventList = service.getPastList();
        requestScope("pastEventList", pastEventList);

        // イベント一覧画面へ遷移
        return forward("list.jsp");
    }
}
